﻿@model IEnumerable<WebChat.Models.Message>

@{
    ViewBag.Title = "Meldinger";
}

<h2>Meldinger</h2>

@using (Html.BeginForm()) {
<fieldset>
<input type="text" name="fname"/><br />
<input type="submit" value="Søk" />
</fieldset>
}

<table>
    <tr>
        <th>
            Forfatter
        </th>
        <th>
            Dato
        </th>
        <th>
            Chatroom
        </th>
        <th>
            Melding
        </th>
        <th></th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.name)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Date)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Chatroom)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Message1)
        </td>
        <td>
            @Html.ActionLink("Detaljer", "DetailsMessages", new { id=item.Id }) |
            @Html.ActionLink("Slett", "DeleteMessages", new { id = item.Id })
        </td>
    </tr>
}

</table>
<div>
    @Html.ActionLink("Tilbake", "Index")
</div>